package cn.lucky.springcloud.controller;

import cn.lucky.springcloud.entities.CommonResult;
import cn.lucky.springcloud.entities.Payment;
import cn.lucky.springcloud.service.OpenfeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author lingpeng.jiang
 * @create 2020-12-27-15:54
 */
@RestController
@Slf4j
@RequestMapping("/openfeign/consumer")
public class OpenfeignController {

    @Autowired
    private OpenfeignService openfeignService;

    @GetMapping("/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        return openfeignService.getPaymentById(id);
    }


    @GetMapping("/payment/list")
    public CommonResult<Payment> queryPayment(){
        return openfeignService.queryPayment();
    }

    @GetMapping("/consumer/payment/openfeign/timeout")
    public String testOpenFeignTimeOut(){
        return openfeignService.testOpenfeignTimeOut();
    }
}
